//
//  VipCollectionViewCell.m
//  markmap
//
//  Created by 甘世清 on 2024/6/21.
//

#import "VipCollectionViewCell.h"

@implementation VipCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.backgroundColor = UIColor.clearColor;
        [self.contentView addSubview:self.topView];
        [self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.contentView);
            make.size.mas_equalTo(40);
            make.top.equalTo(self.contentView).offset(22);
        }];
        
        [self.contentView addSubview:self.nameLabel];
        [self.contentView addSubview:self.messageLabel];
        [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.contentView);
            make.top.equalTo(self.contentView).offset(70);
        }];
        [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.contentView);
            make.top.equalTo(self.contentView).offset(90);
           
        }];
        
    }
    return self;
}
- (void)setName:(NSString *)name{
    _name = name;
    self.topView.image = SQGetImage(name);
    if ([name isEqualToString:@"VIP 图标"]) {
        self.nameLabel.text = SQNSLocalString(@"尊贵VIP标识");
        self.messageLabel.text = SQNSLocalString(@"让您脱颖而出");
    } else if ([name isEqualToString:@"访客"]){
        self.nameLabel.text = SQNSLocalString(@"揭秘近期访客");
        self.messageLabel.text = SQNSLocalString(@"访客列表一览无余");
    } else if ([name isEqualToString:@"打招呼"]){
        self.nameLabel.text = SQNSLocalString(@"主动发起打招呼");
        self.messageLabel.text = SQNSLocalString(@"无限畅聊 想聊就撩");
    } else if ([name isEqualToString:@"人气值"]){
        self.nameLabel.text = SQNSLocalString(@"提升自身人气值");
        self.messageLabel.text = SQNSLocalString(@"赢得更多友谊");
    }
}
- (UIImageView *)topView{
    if (!_topView) {
        _topView = [[UIImageView alloc]init];
        _topView.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _topView;
}
- (UILabel *)messageLabel{
    if (!_messageLabel) {
        _messageLabel = [[UILabel alloc]init];
        _messageLabel.font = FONT_REGULAR(13);
        _messageLabel.textColor =  SQColor(@"#BFB1AB");
        _messageLabel.adjustsFontSizeToFitWidth = YES;
    }
    return _messageLabel;
}
 
- (UILabel *)nameLabel{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.font = FONT_MEDIUM(14);
        _nameLabel.textColor =  SQColor(@"#F8C8AF");
        _nameLabel.backgroundColor = UIColor.clearColor;
        _nameLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _nameLabel;
}
@end
